﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ShoppingCart
{
    public class Calculator
    {
        /*
         * itemPrice calculates the price of a set of the same items from their unit price and quantity.
         * Example: 2 packs of gum would be $0.50*2=$1.00
         */
        public double itemPrice(double price, int quantity)
        {
            double ip = price * quantity;
            return ip;
        }

        /*
         * subTotCalc calculates the subtotal from an array of prices.
         */
        public double subTotCalc(double[] prices)
        {
            double subTot = 0;
            for (int i = 0; i < prices.Length; i++)
            {
                subTot += prices[i];
            }

            return subTot;
        }
    }
}
